Developer Documentation
PATH  WebObjects 4.5 Documentation > Getting Started With Direct to Java Client

   

Unarchiving XML

To see how an EOXMLUnarchiver processes the XML returned from the server, consider the following XML:

<MODALDIALOGCONTROLLER reuseMode="ReuseIfInvisible"
disposeIfDeactivated="false" typeName="question = modalDialog,
task = select, entity = Studio">

    <ACTIONBUTTONSCONTROLLER widgetPosition="Top">
        <QUERYCONTROLLER entity="Studio" minimumWidth="256"
        alignsComponents="true">

            <TEXTFIELDCONTROLLER valueKey="name"
            isQueryWidget="true"/>

            <LISTCONTROLLER minimumWidth="256" editability="Never"
            alignsComponents="true" entity="Studio">

                <TABLECONTROLLER>
                    <TABLECOLUMNCONTROLLER editability="Never"
                    valueKey="name"/>

                    <TABLECOLUMNCONTROLLER valueKey="budget"
                    formatPattern="#,##0.00;-#,##0.00"
                    editability="Never"
                    formatClass=
                    "com.apple.client.foundation.NSNumberFormatter"/>

                </TABLECONTROLLER>
            </LISTCONTROLLER>
        </QUERYCONTROLLER>
    </ACTIONBUTTONSCONTROLLER>
</MODALDIALOGCONTROLLER>

This XML describes the controller hierarchy for the Tutorial application's select Studio dialog. The XML tags--MODALDIALOGCONTROLLER, ACTIONBUTTONSCONTROLLER, and so on-- specify a controller class. The XML attributes--reuseMode, disposeIfDeactivated, and so on--specify how to configure the corresponding controller.

The EOXMLUnarchiver maps XML tags to particular EOController classes. For example, the following table describes the mappings for the tags in the select Studio dialog XML.

XML Tag

Controller Class

MODALDIALOGCONTROLLER

EOModalDialogController

ACTIONBUTTONSCONTROLLER

EOActionButtonsController

QUERYCONTROLLER

EOQueryController

TEXTFIELDCONTROLLER

EOTextFieldController

LISTCONTROLLER

EOListController

TABLECONTROLLER

EOTableController

TABLECOLUMNCONTROLLER

EOTableColumnController

You can change the controller class with which a particular XML tag corresponds by writing a custom rule or by freezing XML. Writing custom rules and freezing XML are discussed in the chapter Customizing Direct to Java Client Applications.

As an XML unarchiver creates the controller hierarchy, it configures the controllers according to the specified XML attribute values. For example, the XML attributes for the EOTextField are valueKey and isQueryWidget:

<TEXTFIELDCONTROLLER valueKey="name" isQueryWidget="true"/>

These attributes correspond to the EOTextField methods setValueKey and setIsQueryWidget. The valueKey="name" specifies that the text field controller corresponds to a property named "name" (in this case, the name attribute of a Studio object). The isQueryWidget="true" specifies that the text field is used to get search criteria from the user and not to display and edit a property's value

For information on the XML tags and attributes for the EOController classes, see the EOApplication Framework Referenceand the EOGeneration Framework Reference.


© 1999 Apple Computer, Inc. – (Draft. Last updated 05 Jan 00)